//
//  ViewFactory.swift
//  GreenDeal
//
//  Created by Moennig Q on 2023/3/14.
//

import UIKit
class ViewFactory {
    static let shared = ViewFactory()
    //获取提示Label
    func generateRequiredLabel()->BaseLabel{
        let label = BaseLabel()
        label.textColor = UIColor(hexStr: "#ED3E3E")
        label.setFont(R.font.sfProTextRegular(size: 11))
        label.textAlignment = .left
        label.numberOfLines = 0
        return label
    }
    //MARK: - 生成标题label
    func generateLabel(_ title: String, textColor: UIColor = UIColor(hexStr: "#444444"))->BaseLabel{
        let label = BaseLabel()
        label.text = title
        label.textColor =  textColor
        label.setFont(R.font.sfProTextRegular(size: 15))
        return label
    }
    //获取提示Textview
    func generateTextView()->BaseTextView{
        let textView = BaseTextView()
        textView.backgroundColor = .white
        textView.textAlignment = .left
        textView.textColor = UIColor(hexStr: "#252224")
        textView.setFont(R.font.sfProTextRegular(size: 15))
        textView.keyboardType = .default
        textView.returnKeyType = .done
        textView.layer.cornerRadius = Constant.StandardCornerRadius
        textView.layer.borderColor = UIColor(hexStr: "#292D3233").cgColor
        textView.layer.borderWidth = 1
        return textView
    }
    //生成More image
    func generateMoreImageView()->UIImageView{
        let view = UIImageView()
        view.image = UIImage(named: "more_gray_icon")
        return view
    }
    //MARK: - 生成待边框的label
    func generateLabelWithBorder(textHexStr: String)->PaddingLabel{
        let view = PaddingLabel()
        view.textColor = UIColor(hexStr: textHexStr)
        view.setFont(R.font.interMedium(size: 12))
        view.backgroundColor = UIColor.white
        view.layer.cornerRadius = Constant.StandardCornerRadius
        view.layer.borderWidth = 1
        view.layer.borderColor = UIColor(hexStr: textHexStr).cgColor
        view.clipsToBounds = true
        return view
    }
    //MARK: - 生成弹出框上边的底部按钮
    func generateButtonOnAlertView(_ title: String = "")->BaseButton{
        let btn = BaseButton()
        btn.setTitle(title, for: UIControl.State.normal)
        btn.setTitleColor(UIColor(hexStr: "#379657"), for: UIControl.State.normal)
        btn.setFont(R.font.interSemiBold(size: 17))
        return btn
    }
}
